# Maintainer: Jan Alexander Steffens (heftig) <jan.steffens@gmail.com>
# Contributor: Kaiting Chen <kaitocracy@gmail.com>
# Contributor: Martin Häger <martin.haeger@gmail.com>

pkgname=liboauth
pkgver=1.0.3+r16+gc26f038
pkgrel=1
epoch=1
pkgdesc="C library implementing OAuth Core RFC 5849"
url="https://github.com/x42/liboauth"
arch=(x86_64)
license=(MIT)
depends=(curl nss)
makedepends=(git)
_commit=c26f038eb9a4d97782e3f9f1e3da2b9356581869  # master
source=("git+$url#commit=$_commit")
sha256sums=('SKIP')

prepare() {
  cd liboauth
  autoreconf -fvi
}

pkgver() {
  cd liboauth
  git describe --tags | sed 's/^v//;s/[^-]*-g/r&/;s/-/+/g'
}

build() {
  cd liboauth
  ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var \
    --disable-static --enable-nss
  sed -i -e 's/ -shared / -Wl,-O1,--as-needed\0/g' libtool
  make
}

check() {
  cd liboauth
  make check
}

package() {
  cd liboauth
  make DESTDIR="$pkgdir" install
  install -Dt "$pkgdir/usr/share/licenses/$pkgname" -m644 COPYING.MIT
}

# vim:set sw=2 sts=-1 et:
